import {connect} from 'react-redux';

// 业务组件
import AddTask  from './components/AddTask';
import TasksList from './components/TasksList';

//=>redux
//1 组件state=>store state中
//2 组件行为 = > reducer
//3 重构页面组件: redux 中的数据和行为 对现有组件进行增强
function Tasks(props){
    const {tasksTotle} = props
    return (
        <div>
            <h1> Today Tasks : {tasksTotle}</h1>
            <AddTask />
            <TasksList />
        </div>
    )
}

const mapState = state =>{
    return {
        tasksTotle:state.task.tasks.length
    }
}

export default connect(mapState,null)(Tasks);
